<script>
	import config from 'config/index'
	import Toast from '@/wxcomponents/vant/toast/toast'
	export default {
		onLaunch: function() {
			// console.log('App Launch')
			// this.login()
		},
		onShow: function() {
			// console.log('App Show')
		},
		created() {
			let dict = {
				educationList: [{id: '1',name: '小学'},{id: '2',name: '初中'},{id: '3',name: '高中'},{id: '4',name: '大学专科'},{id: '5',name: '大学本科'},{id: '6',name: '研究生'},{id: '7',name: '博士'},{id: '8',name: '其他'}
				]
			}
			this.$storage.setItem('dict',dict);
		},
		methods: {
			login() {
				let that = this;
				uni.login({
					provider:'weixin',
					success: res => {
						uni.request({
							url: config.baseURL + '/rfdt/miniUser/login',
							method: 'POST',
							data: {
								code : res.code
							},
							header: {
								'content-type': 'application/x-www-form-urlencoded'
							},
							success: result => {
								let ret = result.data;
								if (ret.status == 1) {
									uni.setStorageSync('accessToken', JSON.stringify(ret.token));
								} else {
									uni.setStorageSync('sk', JSON.stringify(ret.sk));
								}
								Toast.clear()
								if (ret.userInfo) {
									uni.setStorageSync('userInfo', JSON.stringify(ret.userInfo));
									uni.reLaunch({
										url: '/pages/tabbar/index/index'
									});
								}
							}
						})
					},
					fail: error => {
						console.log('fail', error)
					}
				})
			}
		},
		onHide: function() {
			// console.log('App Hide')
		}
	}
</script>

<style lang="scss">
	// .allBackground {
	// 	/deep/ .van-cell {
	// 		background-color: #f5f5f5;
	// 	}
	// }
	.br {
		width: 100%;
		height: 20rpx;
		background-color: #f5f5f5;
	}
	// canvas
	.canHidden {
		position: absolute;
		left: 0;
		top: 999999999999999999rpx;
	}
	//处理css中英文换行时字距不对
	.handLetterSpa {
		word-break: break-all;
		word-wrap: break-word;
		text-align: justify;
	}
	// 超出部分显示点点点
	.exceedHidden {
		overflow: hidden ;
		white-space: nowrap ;
		text-overflow: ellipsis ;
	}
	.loading{
		line-height: 2em;
		text-align: center;
		color: #525252;
		margin-top: 30rpx;
		font-size: 30rpx;
	}
	.noData{
		text-align: center;
		padding-top: 300rpx;
		.text{
			font-size: 32rpx;
			color: #666666;
			margin-top: 15rpx;
		}
		image{
			width: 440rpx;
			height: 440rpx;
		}
	}
	.columnCenter {
		flex-direction: column;
		justify-content: center;
		align-items: center;
	}
	/deep/ .van-cell {
		flex-direction: column;
	}
	.row {
		/deep/ .van-cell {
			flex-direction: row;
		}
	}
	.column {
		/deep/ .van-cell {
			flex-direction: column;
		}
	}
	.commonBtnBox {
		position: absolute;
		bottom: 0;
		left: 0;
		width: 100%;
		margin-bottom: 24rpx;
		text-align: center;
		font-size: 32rpx;
		/deep/ .van-button {
			width: calc(100% - 64rpx);
			background-color: #02BF88;
		}
	}
	/deep/ .van-toast--icon {
		width: 260rpx !important;
	}
	/deep/ .van-uploader__wrapper {
		width: 100vw;
	}
	/deep/ .van-uploader__slot {
		width: 26% !important;
	}
	//去除滚动条
	.bodeStyle {
		height: 100vh;
		overflow-y: scroll;
		&::-webkit-scrollbar {
				width: 0;
				height: 0;
				color:transparent;
		    display: none; /* Chrome Safari */
		  }
	}
	
	/deep/ .van-sticky {
		height: 40px;
		z-index: 99;
		.van-sticky-wrap {
			position: fixed;
			right: 0;
			left: 0;
		}
	}
	
	/*每个页面公共css */
</style>
